library rain_ui;

import 'package:flutter/cupertino.dart';
import 'package:rain_ui/theme/base/rain_base_theme.dart';
import 'package:oktoast/oktoast.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:rain_ui/theme/rain_theme.dart';

export 'package:flutter_screenutil/flutter_screenutil.dart';

class RainUi {
  static const String package = 'rain_ui';

  static late BuildContext _context;

  static BuildContext get context => _context;

  static Widget init({
    required BuildContext context,
    required Widget Function(BuildContext context, RainBaseTheme theme) builder,
    Size designSize = const Size(375, 667),
    ToastPosition toastPosition = const ToastPosition(align: Alignment.center),
    ScrollBehavior? behavior,
  }) {
    _context = context;
    return ScreenUtilInit(
      builder: () {
        return OKToast(
          position: toastPosition,
          child: builder(context, RainTheme.of(context)),
        );
      },
      designSize: designSize,
    );
  }
}
